|
|
|
|
|
|
|
The AllTransactions class has the two notable methods: Add and saveAllTransactions. Listing 17.4 shows this code. |
|
|
|
|
|
|
|
|
LISTING 17.4. NOTABLE METHODS OF THEAllTransactionsCLASS. |
|
|
|
 |
|
|
|
|
1:
2: Public Sub Add(TellerID As String, TransID As Long, DateTimeStamp As Date, Optional sKey As String) ' As Transaction
3: 'create a new object
4: Dim objNewMember As Transaction
5: Set objNewMember = New Transaction
6: 'set the properties passed into the method
7: objNewMember.TellerID = TellerID
8: objNewMember.TransID = TransID
9: objNewMember.DateTimeStamp = DateTimeStamp
10: If Len(sKey) = 0 Then
11: mCol.Add objNewMember
12: Else
13: mCol.Add objNewMember, sKey
14: End If
15: 'Set Add = objNewMember
16: Set objNewMember = Nothing
17: End Sub
18: Public Sub saveAllTransactions()
19: 'Add the state of each Transaction object
20: 'to the RichTextFile text box. This is for caching of
21: 'Transaction objects in memory before saving
22: ' & vbNewLine
23: Dim aTransaction As Transaction
24: theFileSubsystem.theRichTextFile.FileName = App.Path & \Transactions.txt
25: For Each aTransaction In mCol
26: theFileSubsystem.theRichTextFile.Contents = _
27: theFileSubsystem.theRichTextFile.Contents & _
28: gsSINGLEQUOTE & aTransaction.TellerID & gsSINGLEQUOTE & ,
29: theFileSubsystem.theRichTextFile.Contents = _
30: theFileSubsystem.theRichTextFile.Contents & _
31: aTransaction.TransID & ,
32: theFileSubsystem.theRichTextFile.Contents = _
33: theFileSubsystem.theRichTextFile.Contents & _
34: aTransaction.DateTimeStamp & vbNewLine
35: Next
36: 'theFileSubsystem.theRichTextFile.showContents
37: theFileSubsystem.theRichTextFile.saveFile
38: End Sub
39: |
|
|
|
|
|